//
//  UIViewController+BarItem.m
//  duzhoumo
//
//  Created by dzmmac on 15/10/27.
//  Copyright © 2015年 dzmmac. All rights reserved.
//

#import "UIViewController+BarItem.h"

@implementation UIViewController (BarItem)

#pragma mark --------------------左侧返回按钮---------------------
/**
 * @brief  左侧返回按钮
 */
-(void)setBackBtnItem{
    UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    [backButton setImage:[UIImage imageNamed:@"btn_backItem"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    UIEdgeInsets inset   = UIEdgeInsetsMake(0, -22, 0, 0);
    backButton.contentEdgeInsets = inset;
    self.navigationItem.leftBarButtonItem = backItem;
}


-(void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
